{include file="public/header" /}





<div class="page">
    <form method="post" name="remark_form" id="remark_form">
        <table class="ds-default-table">
            <input type="hidden" value="{$commonids}" name="commonids">
            <tbody>
            <tr class="noborder">
                <td class="required"><label>{$Think.lang.integral}:</label></td>
                <td class="vatop rowform"><input id="rewrite_enabled_1" name="score"  value="{$goods_info.score|default=''}" type="text" checked="checked"></td>
                <td class="vatop tips">购买商品赠送积分，大于0及赠送</td>
            </tr>
            <tr class="noborder">
                <td class="required w120"><label class="validation">是否需要安装：</label></td>
                <td class="vatop rowform">  <div class="onoff">
                    <label for="site_state1" style='float: left;' class="cb-enable {$goods_info.install_money > 0 ? "selected" : ''}" >需要</label>
                    <label for="site_state0"  style='float: left;' class="cb-disable {$goods_info.install_money <= 0 ? "selected" : ''}"">不需要</label>
                    <input id="site_state1" name="status" value="1" type="radio" {$goods_info.install_money > 0 ? "checked='checked'" : ''} >
                    <input id="site_state0" name="status" value="2" type="radio" {$goods_info.install_money <= 0 ? "checked='checked'" : ''}>
                </div></td>
                <td class="vatop tips">选择安装时，安装工时必须填写</td>
            </tr>
            <tr class="noborder" id="installation_fee_ero_one" style="{$goods_info.install_money <= 0 ? 'display: none' : ''}">
                <td class="required w120"><label class="validation"  >安装工时:</label></td>
                <td class="vatop rowform"> <input type='text'  name="install_money"  id="install_money" value="{$goods_info.install_money|default='0'}" ></td>
                <td class="vatop tips">选择含有安装时，安装工时必须填写</td>
            </tr>
            <tr class="noborder">
                <td class="required"><label class="validation">销售分享模式（提成）:</label></td>
                <td class="vatop rowform"> <select name='t_type'>
                    <option value="1" <?php if(isset($goods_info) && $goods_info['t_type']==1){?>selected="selected"<?php }?>>百分比</option>
                    <option value="2" <?php if(isset($goods_info) && $goods_info['t_type']==2){?>selected="selected"<?php }?>>固定加价</option>
                </select></td>
                <td class="vatop tips">选择百分比单位：% 选择固定加价单位：元</td>
            </tr>
            <tr class="noborder">
                <td class="required w120"><label class="validation">加价设置值：</label></td>
                <td class="vatop rowform"> <input   name="t_value"  value="{$goods_info.t_value|default=''}" type="text" checked="checked"></td>
                <td class="vatop tips">加价后为平台显示销售价</td>
            </tr>
            <tr class="noborder">
                <td class="required"><label class="validation">运营商分享模式（加价）:</label></td>
                <td class="vatop rowform"> <select name='g_type'>
                    <option value="1" <?php if(isset($goods_info) && $goods_info['g_type']==1){?>selected="selected"<?php }?>>百分比</option>
                    <option value="2" <?php if(isset($goods_info) && $goods_info['g_type']==2){?>selected="selected"<?php }?>>固定加价</option>
                </select></td>
                <td class="vatop tips">选择百分比单位：% 选择固定加价单位：元</td>
            </tr>
            <tr class="noborder">
                <td class="required w120"><label class="validation">加价设置值：</label></td>
                <td class="vatop rowform"> <input   name="g_value"  value="{$goods_info.g_value|default=''}" type="text" checked="checked"></td>
                <td class="vatop tips">加价后为运营成本价</td>
            </tr>





            </tbody>
            <tfoot>
            <tr class="tfoot">
                <td colspan="15" ><input class="btn" type="submit" style ='line-height: 30px;' value="{$Think.lang.ds_submit}"/></td>
            </tr>
            </tfoot>
        </table>
    </form>
</div>
<script src="{$Think.PLUGINS_SITE_ROOT}/layui/layui.js"></script>
<script>
    $(function() {
        jQuery.validator.addMethod("checkFCodePrefix", function (value, element) {
            return this.optional(element) || /^[a-zA-Z]+$/.test(value);
        }, '<i class="iconfont">&#xe64c;</i>{$Think.lang.prompt_information1}');

        $('#remark_form').validate({
            errorPlacement: function (error, element) {
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules: {
                // technician_price: {
                //     required: true,
                //     number: true,
                //     min: 0,
                // },
                score: {
                    number: true,
                    min: 0,
                },
                install_money: {
                    number: true,
                    min: 0,
                },

                t_value: {
                    required: true,
                    number: true,
                    min: 0,
                },

                g_value: {
                    required: true,
                    number: true,
                    min: 0,
                },
            },
            messages: {
                // technician_price: {
                //     required: '不能为空',
                //     number: '设置的数值需要大于零',
                //     min: '请设置正确的数值',
                // },
                score: {
                    number: '设置的数值需要大于零',
                    min: '请设置正确的数值',
                },
                install_money: {
                    number: '设置的数值需要大于零',
                    min: '请设置正确的数值',
                },

                t_value: {
                    required: '不能为空',
                    number: '请设置正确的数值',
                    min: '请设置正确的数值',
                },
                g_value: {
                    required: '不能为空',
                    number: '此数值需要是正整数',
                    min: '设置的数值需要大于零',
                },
            }
        });


        $('input[name="status"]').click(function() {
            if ($(this).val() == 2) {
                $("#installation_fee_ero_one").hide();
            } else {
                $("#installation_fee_ero_one").show();
            }
        });

    });

    $(document).ready(function () {

        $("form").submit(function (e) {

            var res =  $("#remark_form").valid();
            var status = $('input[name="status"]:checked').val();
            if(status==1){
                var install_money = $('#install_money').val();
                if(install_money==''){
                    layer.msg('请填写安装费');return false;
                }
            }
            if(!res){
               return false;
            }


        });
    });

</script>
